#include <cstdint>
#include <iostream>
#include <istream>
#include <vector>

using ll = int64_t;

ll n,ans=0;
std::vector<ll> a,t,s;

static inline ll lb(ll val){
    return val&(-val);
}

static inline void upd(ll idx,ll add){
    while (idx<=n) {
        t[idx]+=add;
        idx+=lb(idx);
    }
}

static inline ll get(ll idx){
    ll res=0;
    while(idx){
        res+=t[idx];
        idx-=lb(idx);
    }
    return res;
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin>>n;
    a.resize(n+2);
    s.resize(n+2);
    t.resize(n+2);
    for(ll i=1;i<=n;++i){
        std::cin>>a[i];
        ++a[i];
    }
    
    for(ll i=1;i<=n;++i){
        ll x = n - a[i] + 2;
        s[a[i]] += get(x-1);
        upd(x, 1);
    }
    
    std::cout<<"0\n";
    for(ll i=2;i<=n;i++){
        ans += s[i-1];
        std::cout<<ans<<"\n";
    }
}
